<?php
if(!isset($in_pmt)) header("Location:index.php");
if(isset($_POST['submit'])){
	$username = trim(strtolower($_POST['username']));
	$password = md5(trim(strtolower($_POST['password'])));
	if($username == $user && $password == $pass){
		$_SESSION['is_logged'] = true;
		$msg->ok("Успешно влизане! <br />");
		$msg->write("<a href=\"index.php\"> Начало</a>");
	} else {
		$msg->error("Грешен потребител или парола! <br />");
		$msg->write("<a href=\"index.php\"> Начало</a>");
	}
} else {
?>
<form action="index.php" method="post">
	<div class="row">
		<label for="username">Потребител:</label>
		<input type="text" name="username" />
	</div>
	<div class="row">
		<label for="password">Парола:</label>
		<input type="password" name="password" />
	</div>
	<div class="row">
		<label for="submit">&nbsp;</label>
		<input type="submit" name="submit" value="Влез" />
	</div>
</form>

<?php
}
?>
